-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WELD-2764 Method invokers, first impl #2864
Conversation
0ba2566
to
313d464
Compare
bdbffce
to
eb14f9c
Compare
e3ddebe
to
b8fa638
Compare
An instance of `CleanupActions` must exist for each _invocation_, not for each _invoker_. This requires some creative juggling of method handle arguments, which is what this commit does.
…ing the ultimate invocation
This currently doesn't help anything, but it should be possible to optimize out `CleanupActions` instantiation completely when we know that it is never used.
This required moving the invoker construction logic from `InvokerImpl` into the `AbstractInvokerBuilder`, which is arguably a better place anyway. The `InvokerImpl` looks fairly minimal now, as it should.
3c0897c
to
9d4538c
Compare
…now be created from any method
Added changes to support recent adjustment in CDI PR - removal of This also reduces the volume of this PR from 96 changes files to just 68 :) |
I guess all of the in-container tests fail because we aren't patching the CDI JAR in WFLY dist; will take a closer look on Mon as to whether we can improve that until we have WFLY version which consumes the expected artifact. |
…n WFLY. Use this in CI jobs.
I've created a follow up JIRA issue capturing leftover TODOs from this one and targetting Alpha2. |
JIRA - WELD-2764
Draft for the prototype of invokeable methods in Weld.
CI failures are expected due toSNAPSHOT
deps.CI should now be fine , there are no longer any snapshot dependencies and there is added profile that allows CDI and interceptors API patching in WFLY. All tests should pass.
The impl is based on Java
MethodHandles
.How to try out:
mvn clean install
) the CDI branch with invokeable methods API proposalmvn clean install -DskipTests
)5.1.2-SNAPSHOT
with draft of the implLooking at performance:
The implementation uses
MethodHandles
and as such is very efficient. The difference in direct method invocation versus invocation viaInvoker
becomes negligible the moment method does anything non-trivial (basically anything else than returning a constant). Currently, I have been playing with some microbenchmarks using JMH to test this. A WIP can be seen over in this repo and branch. If you want to run that:invokableMethods
branchmvn clean install
./run-benchmarks.sh -v "5.1.2-SNAPSHOT" -b "InvokableMethodBenchmarkNoLookup InvokableMethodBenchmarkSimpleBeanInvocation InvokableMethodBenchmarkLookup"
Known TODOs:
Support for build compatible implementations (currently only works via portable extensions)Support exception transformers returning arbitrary value (which is something method handles don't allow out of the box)Properly support lookup with qualifiers@Invokable
we now need to add verification that happens when you attempt to create an invoker for any given method; for instance validate that the method is non-private